package com.li.diy;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class autoPointcut  {

    @Before("execution(* com.service.serviceImpl.userServiceImpl.*(..))")
    public void before(){
        System.out.println("=====方法执行前=======");
    }

    @After("execution(* com.service.serviceImpl.userServiceImpl.*(..))")
    public void after(){
        System.out.println("=====方法执行后=======");
    }

    @Around("execution(* com.service.serviceImpl.userServiceImpl.*(..))")
    public Object around(ProceedingJoinPoint jp) throws Throwable {
        System.out.println("环绕前");
        Signature signature=jp.getSignature();  //获得签名
        System.out.println("signaute"+signature);

        Object proceed=jp.proceed();  //执行方法
        System.out.println("环绕后");
        return proceed;
    }


}
